﻿using System;
using Newtonsoft.Json.Linq;
using RestSharp;

namespace ACFaceAPI
{
    public class FaceAPI
    {
        public RestClient RClient { get; set; }
        public RestRequest RRequest { get; set; }
        
        public FaceAPI(string url)
        {
            RClient = new RestClient(url);
            RRequest = new RestRequest();
        }

        public string QueryInfo()
        {
            RRequest.Resource = @"webapi/query.cgi";
            RRequest.AddParameter("api", "SYNO.API.Info", ParameterType.GetOrPost);
            RRequest.AddParameter("version", "1", ParameterType.GetOrPost);
            RRequest.AddParameter("method", "query", ParameterType.GetOrPost);
            RRequest.AddParameter("query", "all", ParameterType.GetOrPost);
            var r = RClient.Execute(RRequest, Method.GET);
            JObject j = JObject.Parse(r.Content);
            var x = j["data"].ToString();
            return r.Content;
        }

    }
}
